var pin_images=mapfunctions_vars.pin_images; var images=jQuery.parseJSON(pin_images); var ipad_time=0; var infobox_id=0; var shape={ coord:[1, 1, 1, 38, 38, 59, 59 , 1], type:'poly' }; var mcOptions; var mcluster; var clusterStyles; var pin_hover_storage; var first_time_wpestate_show_inpage_ajax_half=0; function wpestate_change_map_type(map_type){ if(map_type==='map-view-roadmap'){ map.setMapTypeId(google.maps.MapTypeId.ROADMAP); }else if(map_type==='map-view-satellite'){ map.setMapTypeId(google.maps.MapTypeId.SATELLITE); }else if(map_type==='map-view-hybrid'){ map.setMapTypeId(google.maps.MapTypeId.HYBRID); }else if(map_type==='map-view-terrain'){ map.setMapTypeId(google.maps.MapTypeId.TERRAIN); }} function setMarkers(map, locations){ "use strict"; console.log('setMarkers'); var map_open; var myLatLng; var selected_id=parseInt(jQuery('#gmap_wrapper').attr('data-post_id')); if(isNaN(selected_id)){ selected_id=parseInt(jQuery('#googleMapSlider').attr('data-post_id'),10); } var open_height=parseInt(mapfunctions_vars.open_height,10); var closed_height=parseInt(mapfunctions_vars.closed_height,10); var boxText=document.createElement("div"); width_browser=jQuery(window).width(); infobox_width=700; vertical_pan=-215; if(width_browser<900){ infobox_width=500; } if(width_browser<600){ infobox_width=400; } if(width_browser<400){ infobox_width=200; } var myOptions={ content:boxText, disableAutoPan:true, maxWidth:infobox_width, boxClass:"mybox", zIndex:null, closeBoxMargin:"-13px 0px 0px 0px", closeBoxURL:"", infoBoxClearance:new google.maps.Size(1, 1), isHidden:false, pane:"floatPane", enableEventPropagation:true }; infoBox=new InfoBox(myOptions); for(var i=0; i < locations.length; i++){ var beach=locations[i]; var id=beach[10]; var lat=beach[1]; var lng=beach[2]; var title=decodeURIComponent(beach[0]); var pin=beach[8]; var counter=beach[3]; var image=decodeURIComponent(beach[4]); var price=decodeURIComponent(beach[5]); var single_first_type=decodeURIComponent(beach[6]); var single_first_action=decodeURIComponent(beach[7]); var link=decodeURIComponent(beach[9]); var city=decodeURIComponent(beach[11]); var area=decodeURIComponent(beach[12]); var cleanprice=beach[13]; var rooms=beach[14]; var baths=beach[15]; var size=beach[16]; var single_first_type_name=decodeURIComponent(beach[17]); var single_first_action_name=decodeURIComponent(beach[18]); var agent_id=beach[19] ; var county_state=beach[20] ; if(mapfunctions_vars.custom_search==='yes'){ var slug1=beach[21]; var val1=beach[22]; var how1=beach[23]; var slug2=beach[24]; var val2=beach[25]; var how2=beach[26]; var slug3=beach[27]; var val3=beach[28]; var how3=beach[29]; var slug4=beach[30]; var val4=beach[31]; var how4=beach[32]; var slug5=beach[33]; var val5=beach[34]; var how5=beach[35]; var slug6=beach[36]; var val6=beach[37]; var how6=beach[38]; var slug7=beach[39]; var val7=beach[40]; var how7=beach[41]; var slug8=beach[42]; var val8=beach[43]; var how8=beach[44]; if(typeof(val1)!=='number'){ val1=val1.replace(" ","-"); } if(typeof(val2)!=='number'){ val2=val2.replace(" ","-"); } if(typeof(val3)!=='number'){ val3=val3.replace(" ","-"); } if(typeof(val4)!=='number'){ val4=val4.replace(" ","-"); } if(typeof(val5)!=='number'){ val5=val5.replace(" ","-"); } if(typeof(val6)!=='number'){ val6=val6.replace(" ","-"); } if(typeof(val7)!=='number'){ val7=val7.replace(" ","-"); } if(typeof(val8)!=='number'){ val8=val8.replace(" ","-"); }} if(typeof(googlecode_regular_vars2)!=='undefined'&&typeof(googlecode_regular_vars2.markers2)!=='undefined'&&googlecode_regular_vars2.markers2.length > 2&&typeof(googlecode_regular_vars2.taxonomy)!=='undefined'){ if(googlecode_regular_vars2.taxonomy==='property_city'){ if(googlecode_regular_vars2.term===city){ createMarker(county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,slug1,val1,how1,slug2,val2,how2,slug3,val3,how3,slug4,val4,how4, slug5, val5, how5, slug6, val6, how6 ,slug7 ,val7, how7, slug8, val8, how8,single_first_type_name, single_first_action_name); }} if(googlecode_regular_vars2.taxonomy==='property_area'){ if(googlecode_regular_vars2.term===area){ createMarker(county_state ,size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,slug1,val1,how1,slug2,val2,how2,slug3,val3,how3,slug4,val4,how4, slug5, val5, how5, slug6, val6, how6 ,slug7 ,val7, how7, slug8, val8, how8,single_first_type_name, single_first_action_name); }} if(googlecode_regular_vars2.taxonomy==='property_category'){ if(googlecode_regular_vars2.term===single_first_type){ createMarker(county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,slug1,val1,how1,slug2,val2,how2,slug3,val3,how3,slug4,val4,how4, slug5, val5, how5, slug6, val6, how6 ,slug7 ,val7, how7, slug8, val8, how8,single_first_type_name, single_first_action_name); }} if(googlecode_regular_vars2.taxonomy==='property_action_category'){ if(googlecode_regular_vars2.term===single_first_action){ createMarker(county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,slug1,val1,how1,slug2,val2,how2,slug3,val3,how3,slug4,val4,how4, slug5, val5, how5, slug6, val6, how6 ,slug7 ,val7, how7, slug8, val8, how8,single_first_type_name, single_first_action_name); }} }else if(typeof(googlecode_regular_vars2)!=='undefined'&&typeof(googlecode_regular_vars2.markers2)!=='undefined'&&googlecode_regular_vars2.markers2.length > 2&&typeof(googlecode_regular_vars2.agent_id)!=='undefined'){ if(parseInt(googlecode_regular_vars2.agent_id,10)===parseInt(agent_id,10)){ createMarker(county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,slug1,val1,how1,slug2,val2,how2,slug3,val3,how3,slug4,val4,how4, slug5, val5, how5, slug6, val6, how6 ,slug7 ,val7, how7, slug8, val8, how8,single_first_type_name, single_first_action_name); }}else{ createMarker(county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,slug1,val1,how1,slug2,val2,how2,slug3,val3,how3,slug4,val4,how4, slug5, val5, how5, slug6, val6, how6 ,slug7 ,val7, how7, slug8, val8, how8,single_first_type_name, single_first_action_name); } if(selected_id===id){ found_id=i; }} if(mapfunctions_vars.generated_pins!=='0'){ myLatLng=new google.maps.LatLng(lat, lng); pan_to_last_pin(myLatLng); } if(mapfunctions_vars.is_prop_list==='1'||mapfunctions_vars.is_tax==='1'){ show_pins_filters_from_file(); }} function createMarker(county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,slug1,val1,how1,slug2,val2,how2,slug3,val3,how3,slug4,val4,how4,slug5, val5, how5, slug6, val6, how6 ,slug7 ,val7, how7, slug8, val8, how8, single_first_type_name, single_first_action_name){ var new_title=''; var myLatLng=new google.maps.LatLng(lat,lng); if(mapfunctions_vars.custom_search==='yes'){ new_title=title.replace('%',' '); new_title=decodeURIComponent(new_title.replace(/\+/g,' ')); Encoder.EncodeType="entity"; new_title=Encoder.htmlDecode(new_title); var marker=new google.maps.Marker({ position:myLatLng, map:map, icon:custompin(pin), shape:shape, title:new_title, zIndex:counter, image:image, idul:id, price:price, category:single_first_type, action:single_first_action, link:link, city:city, area:area, infoWindowIndex:i, rooms:rooms, baths:baths, size:size, county_state:county_state, cleanprice:cleanprice, size:size, category_name:single_first_type_name, action_name:single_first_action_name, slug1:slug1, val1:val1, howto1:how1, slug2:slug2, val2:val2, howto2:how2, slug3:slug3, val3:val3, howto3:how3, slug4:slug4, val4:val4, howto4:how4, slug5:slug5, val5:val5, howto5:how5, slug6:slug6, val6:val6, howto6:how7, slug7:slug7, val7:val7, howto7:how7, slug8:slug8, val8:val8, howto8:how8 }); }else{ var marker=new google.maps.Marker({ position:myLatLng, map:map, icon:custompin(pin), shape:shape, title:title, zIndex:counter, image:image, idul:id, price:price, category:single_first_type, action:single_first_action, link:link, city:city, area:area, infoWindowIndex:i, rooms:rooms, baths:baths, cleanprice:cleanprice, size:size, county_state:county_state, category_name:single_first_type_name, action_name:single_first_action_name }); } gmarkers.push(marker); google.maps.event.addListener(marker, 'click', function(event){ map_callback(new_open_close_map); google.maps.event.trigger(map, 'resize'); if(this.image===''){ info_image=''; }else{ info_image=this.image; } var category=decodeURIComponent(this.category.replace(/-/g,' ')); var action=decodeURIComponent(this.action.replace(/-/g,' ')); var category_name=decodeURIComponent(this.category_name.replace(/-/g,' ')); var action_name=decodeURIComponent(this.action_name.replace(/-/g,' ')); var in_type=mapfunctions_vars.in_text; if(category===''||action===''){ in_type=" "; } var infobaths; if(this.baths!=''){ infobaths=''+this.baths+''; }else{ infobaths=''; } var inforooms; if(this.rooms!=''){ inforooms=''+this.rooms+''; }else{ inforooms=''; } var infosize; if(this.size!=''){ infosize=''+this.size; if(mapfunctions_vars.measure_sys==='ft'){ infosize=infosize+ ' ft2'; }else{ infosize=infosize+' m2'; } infosize=infosize+''; }else{ infosize=''; } var title=this.title.substr(0, 45) if(this.title.length > 45){ title=title+"..."; } infoBox.setContent('
'+mapfunctions_vars.half_no_results+'
'); } jQuery('#results').hide(); }else{ jQuery('#gmap-noresult').hide(); if(!bounds.isEmpty()){ map.fitBounds(bounds); } jQuery("#results, #showinpage,#showinpage_mobile").show(); jQuery("#results_no").show().empty().append(results_no); if(parseInt(mapfunctions_vars.is_half)===1){ if(first_time_wpestate_show_inpage_ajax_half===0){ first_time_wpestate_show_inpage_ajax_half=1 }else{ wpestate_show_inpage_ajax_half(); }} }}else{ get_filtering_ajax_result(); if(!bounds.isEmpty()){ map.fitBounds(bounds); } if(mapfunctions_vars.adv_search_type===2||mapfunctions_vars.adv_search_type==='2'){ wpestate_show_inpage_ajax_tip2(); }} if(typeof(mcluster)!=='undefined'){ mcluster.repaint(); }} function wpestate_show_inpage_ajax_tip2(){ if(jQuery('#gmap-full').hasClass('spanselected')){ jQuery('#gmap-full').trigger('click'); } if(mapfunctions_vars.custom_search==='yes'){ custom_search_start_filtering_ajax(1); }else{ start_filtering_ajax(1); }} function wpestate_show_inpage_ajax_half(){ jQuery('.half-pagination').remove(); if(mapfunctions_vars.custom_search==='yes'){ custom_search_start_filtering_ajax(1); }else{ start_filtering_ajax(1); }} function enable_half_map_pin_action(){ jQuery('#google_map_prop_list_sidebar .listing_wrapper').hover(function(){ var listing_id=jQuery(this).attr('data-listid'); wpestate_hover_action_pin(listing_id); }, function(){ var listing_id=jQuery(this).attr('data-listid'); wpestate_return_hover_action_pin(listing_id); } ); } function convertToSlug(Text){ return Text .toLowerCase() .replace(/ /g,'-') .replace(/[^\w-]+/g,'') ; } function custompin(image){ "use strict"; var extension=''; var ratio=jQuery(window).dense('devicePixelRatio'); if(ratio>1){ extension='_2x'; } var custom_img; if(image!==''){ if(typeof(images[image])==='undefined'||images[image]===''){ custom_img=mapfunctions_vars.path+'/'+image+extension+'.png'; }else{ custom_img=images[image]; if(ratio>1){ custom_img=custom_img.replace(".png","_2x.png"); }} }else{ custom_img=mapfunctions_vars.path+'/none.png'; } if(typeof(custom_img)==='undefined'){ custom_img=mapfunctions_vars.path+'/none.png'; } if(ratio>1){ image={ url:custom_img, size:new google.maps.Size(118, 118), scaledSize:new google.maps.Size(44, 48), origin:new google.maps.Point(0,0), anchor:new google.maps.Point(16,49), optimized:false };}else{ image={ url:custom_img, size:new google.maps.Size(59, 59), origin:new google.maps.Point(0,0), anchor:new google.maps.Point(16,49) };} return image; } function Label(opt_options){ this.setValues(opt_options); var span=this.span_=document.createElement('span'); span.style.cssText='position:relative; left:-50%; top:8px; ' + 'white-space:nowrap; ' + 'padding:2px; background-color:white;opacity:0.7'; var div=this.div_=document.createElement('div'); div.appendChild(span); div.style.cssText='position:absolute; display:none'; }; Label.prototype=new google.maps.OverlayView; Label.prototype.onAdd=function(){ var pane=this.getPanes().overlayImage; pane.appendChild(this.div_); var me=this; this.listeners_=[ google.maps.event.addListener(this, 'position_changed', function(){ me.draw(); }), google.maps.event.addListener(this, 'visible_changed', function(){ me.draw(); }), google.maps.event.addListener(this, 'clickable_changed', function(){ me.draw(); }), google.maps.event.addListener(this, 'text_changed', function(){ me.draw(); }), google.maps.event.addListener(this, 'zindex_changed', function(){ me.draw(); }), google.maps.event.addDomListener(this.div_, 'click', function(){ if(me.get('clickable')){ google.maps.event.trigger(me, 'click'); }}) ]; }; Label.prototype.onRemove=function(){ this.div_.parentNode.removeChild(this.div_); for(var i=0, I=this.listeners_.length; i < I; ++i){ google.maps.event.removeListener(this.listeners_[i]); }}; Label.prototype.draw=function(){ var projection=this.getProjection(); var position=projection.fromLatLngToDivPixel(this.get('position')); var div=this.div_; div.style.left=position.x + 'px'; div.style.top=position.y + 'px'; var visible=this.get('visible'); div.style.display=visible ? 'block':'none'; var clickable=this.get('clickable'); this.span_.style.cursor=clickable ? 'pointer':''; var zIndex=this.get('zIndex'); div.style.zIndex=zIndex; this.span_.innerHTML=this.get('text').toString(); }; function close_adv_search(){ } function new_show_advanced_search(){ jQuery("#search_wrapper").removeClass("hidden"); } function new_hide_advanced_search(){ if(mapfunctions_vars.show_adv_search==='no'){ jQuery("#search_wrapper").addClass("hidden"); }} function wpestate_hover_action_pin(listing_id){ for(var i=0; i < gmarkers.length; i++){ if(parseInt(gmarkers[i].idul,10)===parseInt(listing_id,10)){ pin_hover_storage=gmarkers[i].icon; gmarkers[i].setIcon(custompinhover()); }} } function wpestate_return_hover_action_pin(listing_id){ for(var i=0; i < gmarkers.length; i++){ if(parseInt(gmarkers[i].idul,10)===parseInt(listing_id,10)){ gmarkers[i].setIcon(pin_hover_storage); }} } function custompinhover(){ "use strict"; var custom_img,image; var extension=''; var ratio=jQuery(window).dense('devicePixelRatio'); if(ratio>1){ extension='_2x'; } custom_img=mapfunctions_vars.path+'/hover'+extension+'.png'; if(ratio>1){ image={ url:custom_img, size:new google.maps.Size(118, 118), scaledSize:new google.maps.Size(44, 48), origin:new google.maps.Point(0,0), anchor:new google.maps.Point(25,72) };}else{ image={ url:custom_img, size:new google.maps.Size(90, 90), origin:new google.maps.Point(0,0), anchor:new google.maps.Point(25,72) };} return image; } function show_pins_filters_from_file(){ "use strict"; console.log('show_pins_filters_from_file'); if(jQuery("#a_filter_action").length==0){ var action=jQuery('#second_filter_action').attr('data-value'); var category=jQuery('#second_filter_categ').attr('data-value'); var city=jQuery('#second_filter_cities').attr('data-value'); var area=jQuery('#second_filter_areas').attr('data-value'); var county=jQuery('#second_filter_county').attr('data-value'); }else{ var action=jQuery('#a_filter_action').attr('data-value'); var category=jQuery('#a_filter_categ').attr('data-value'); var city=jQuery('#a_filter_cities').attr('data-value'); var area=jQuery('#a_filter_areas').attr('data-value'); var county=jQuery('#a_filter_county').attr('data-value'); } if(typeof(action)!=='undefined'){ action=action.toLowerCase().trim().replace(" ", "-"); } if(typeof(action)!=='undefined'){ category=category.toLowerCase().trim().replace(" ", "-"); } if(typeof(action)!=='undefined'){ city=city.toLowerCase().trim().replace(" ", "-"); } if(typeof(action)!=='undefined'){ area=area.toLowerCase().trim().replace(" ", "-"); } if(typeof(county)!=='undefined'){ county=county.toLowerCase().trim().replace(" ", "-"); } if(typeof infoBox!=='undefined'&&infoBox!==null){ infoBox.close(); } var bounds=new google.maps.LatLngBounds(); if(!isNaN(mcluster)){ mcluster.setIgnoreHidden(true); } if(typeof gmarkers!=='undefined'){ for(var i=0; i